<?php
session_start();
include ("protected/db_sigeco.php");
include ("db_secure.php");
if(!$_SESSION['idutilizador'])
{
	session_destroy();
	header("location:acessoreservado.php");
}

$action = $_POST['action'];
$idprova = $_POST['idprova'];
$idutilizador = $_POST['idutilizador'];

$dbconn = pg_connect("host=$host dbname=$db user=$user password=$pass")
or die('Sem liga&ccedil;&atilde;o: ' . pg_last_error());


$query = validarSQL("SELECT idaluno, classificacao FROM classificacoes WHERE idprova=$idprova");
$resultado = pg_query($query) or die('Query failed:' . pg_last_error());

$resposta="<table class=\"tabelaLista\"><thead><th>Aluno</th><th>Nota</th></thead>";
while($linha = pg_fetch_row($resultado)){
	$resposta=$resposta . "<tr><td>$linha[0]</td><td>$linha[1]</td></tr>";
}
$resposta=$resposta . "</table>";
echo $resposta;
?>